<%@page contentType="text/html;charset=utf-8" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>当当图书 – 全球最大的中文网上书店</title>
		<link href="${path}/front/css/book.css" rel="stylesheet" type="text/css" />
		<link href="${path}/front/css/second.css" rel="stylesheet" type="text/css" />
		<link href="${path}/front/css/secBook_Show.css" rel="stylesheet" type="text/css" />
		<link href="${path}/front/css/shopping_vehicle.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="${path}/front/js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript">
		//点击修改按钮
		function updateCount(bookId) {
			//获取输入框的值
				var count=$("#"+bookId).val();
				
				//输入的值必须是大于0的正整数
				var a=/^[1-9]\d*$/;//     /^[1-9]\d*$/  ：为正则表达式，代表大于0的正整数
				if(a.test(count)){
					//发送修改请求
					location.href="${path}/shoping/updateCount?id="+bookId+"&count="+count;
				}else{
					alert("请输入大于0的正整数");
				}
		}
		</script>
	</head>
	<body>
		<br />
		<br />
		<div class="my_shopping">
			<img class="pic_shop" src="${path}/front/images/pic_myshopping.gif" />
		</div>
		
		<c:if test="${shopcat==null || totalPrice ==0}">
		<div id="div_no_choice">
			<div class="choice_title"></div>
			<div class="no_select">
				您还没有挑选商品[<a href='${path}/fcategory/queryAllSecondAction'> 继续挑选商品&gt;&gt;</a>]
			</div>
		</div>
		 </c:if>
		<!-- 判断如果购物车的session中的map==null,或者图书的状态中没有状态为一的，不显示购物车的表-->
		<c:if test="${shopcat!=null && totalPrice !=0}">
		<div id="div_choice" class="choice_merch">
			<h2 id="cart_tips">
				您已选购以下商品
			</h2>
			<div class="choice_bord">
				<table class="tabl_buy" id="tbCartItemsNormal">
					<tr class="tabl_buy_title">
						<td class="buy_td_6">
							<span>&nbsp;</span>
						</td>
						<td>
							<span class="span_w1">图片</span>
						</td>
						<td>
							<span class="span_w1">商品名</span>
						</td>
						<td class="buy_td_5">
							<span class="span_w2">市场价</span>
						</td>
						<td class="buy_td_4">
							<span class="span_w3">当当价</span>
						</td>
						<td class="buy_td_1">
							<span class="span_w2">数量</span>
						</td>
						<td class="buy_td_2">
							<span>变更数量</span>
						</td>
						<td class="buy_td_1">
							<span class="span_w2">原价小计</span>
						</td>						
						<td class="buy_td_1">
							<span class="span_w2">优惠后小计</span>
						</td>
						<td class="buy_td_1">
							<span>删除</span>
						</td>
					</tr>
					<tr class='objhide' over="no">
						<td colspan="8">
							&nbsp;
						</td>
					</tr>
					
					<c:forEach items="${sessionScope.shopcat}" var="map">
					<!-- 判段图书的状态如果是1,显示 -->
					<c:if test="${map.value.state==1}">
                      <!-- 购物列表开始 -->
						<tr class='td_no_bord'>
							<td style='display: none'>
								9317290
							</td>
							<td class="buy_td_6">
								<span class="objhide">
								
							</td>
							<!-- 图片 -->
							<td>
								<img src="${path}${map.value.book.src}" /> </span></td>
							<td>
								<a href="#"><c:out value="${map.value.book.bookname}"></c:out></a>
							
							</td>
							<td class="buy_td_5">
								<span class="c_gray">${map.value.book.price}</span>
							</td>
							<td class="buy_td_4">
								&nbsp;&nbsp;
								<span>￥${map.value.book.ddprice}</span>
								
							</td>
							
						
							<td class="buy_td_1">
								&nbsp;&nbsp;${map.value.count}
							</td>

							<td >
								<input id="${map.key}"  class="del_num" type="text" size="3" maxlength="4"/>
								<a  onClick="updateCount('${map.key}')">变更</a>
							</td>
							<td class="buy_td_4">
								&nbsp;&nbsp;
								<span>￥${map.value.subtotal}</span>
							</td>
							<td class="buy_td_4">
								&nbsp;&nbsp;
								<span>￥${map.value.subtotaldd}</span>
							</td>
							<td>
								<a href="${path}/shoping/delectShopCatBook?id=${map.key}">删除</a>
							</td>
						</tr>
						</c:if>
						</c:forEach>
						
					<!-- 购物列表结束 -->
				</table>

				<div class="choice_balance">
					<div class="select_merch">
						<a href='${path}/fcategory/queryAllSecondAction'> 继续挑选商品>></a>
					</div>
					<div class="total_balance">
						<div class="save_total">
							您共节省：
							<span class="c_red"> ￥${savePrice}<span id="total_economy"></span> </span>
							<span id='total_vip_economy' class='objhide'> 
								( 其中享有优惠： 
								<span class="c_red"> ￥${savePrice}<span id='span_vip_economy'></span> </span>
								) 
							</span>
							<span style="font-size: 14px">|</span>
							<span class="t_add">商品金额总计：</span>
							<span class="c_red_b"> ￥<span id='total_account'>${totalPrice}</span>
							</span>
						</div>
						<div id="balance" class="balance">
							<a name='checkout' href='../order/order_info.jsp' > 
								<img src="../images/butt_balance.gif" alt="结算" border="0" title="结算" />
							</a>
						</div>
					</div>
				</div>
			</div>
		</div>
</c:if>
		<!-- 用户删除恢复区 -->
		<div id="divCartItemsRemoved" class="del_merch">
			<div class="del_title">
				您已删除以下商品，如果想重新购买，请点击“恢复”
			</div>
			<table class=tabl_del id=del_table>
				<tbody>
				<c:forEach items="${sessionScope.shopcat}" var="map">
				<!-- 判段图书的状态如果是0,显示 -->
					<c:if test="${map.value.state==0}">
					
					<tr>
						<td width="58" class=buy_td_6>
							&nbsp;
						</td>
						<td width="365" class=t2>
							<a href="#">${map.value.book.bookname}</a>
						</td>
						<td width="106" class=buy_td_5>
							${map.value.book.price}
						</td>
						<td width="134" class=buy_td_4>
							<span>￥${map.value.book.ddprice}</span>
						</td>
						<td width="56" class=buy_td_1>
							<a href="${path}/shoping/recoverBook?id=${map.key}">恢复</a>
						</td>
						<td width="16" class=objhide>
							&nbsp;
						</td>
					</tr>
					</c:if>
				
				</c:forEach>
					<tr class=td_add_bord>
						<td colspan=8>
							&nbsp;
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<!-- 用户删除恢复区结束 -->
		<br />
		<br />
		<br />
		<br />
		<!--页尾开始 -->
		<%@include file="../common/foot.jsp"%>
		<!--页尾结束 -->
	</body>
</html>



